Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow submiting images alongside notes in the sdk #232

Merged
merged 15 commits into from
Aug 15, 2024

Conversation

brandon-groundlight
Copy link
Collaborator

@brandon-groundlight brandon-groundlight commented Aug 12, 2024

We previously allowed users to create text notes for detectors. (Notes allow users to provide additional instruction for their task, which can aid human reviewers and improve ML performance). Now users can attach an image as well!

Copy link
Contributor

@timmarkhuff timmarkhuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I tried it out and it was pretty straightforward. I wonder if we want to allow users to submit images in other formats (PIL and numpy) like we do in other situations, but it's not a big deal.

Comment on lines 737 to 738
:param image_query: Either an ImageQuery object (returned from
`submit_image_query`) or an image_query id as a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

returned from submit_image_query

My understanding is that we encourage users to use ask_* methods instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point. Does 'ask_ml or similar method' sound better? ask_* feels a little cheeky

@@ -180,16 +181,26 @@ def get_notes(self, detector: Union[str, Detector]) -> Dict[str, Any]:
det_id = detector.id if isinstance(detector, Detector) else detector
return self.notes_api.get_notes(det_id)

def create_note(self, detector: Union[str, Detector], note: Union[str, NoteRequest]) -> None:
def create_note(self, detector: Union[str, Detector], note: str, image: Union[str, None] = None) -> None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I though Union was replaced with |, e.g. detector: str | Detector. Maybe this doesn't work for some of the python versions we support?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nailed it, we still support python before 3.10

Comment on lines +195 to +197
# TODO: The openapi generator doesn't handle file submissions well at the moment, so we manually implement this
# kwargs = {"image": img_bytes}
# self.notes_api.create_note(det_id, note, **kwargs)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will we ever resolve this TODO? Or is it a permanent issue? If permanent I'm not sure you need to include how we would have solved it if the generator worked.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I very much would like to resolve the issue, but it really just doesn't make sense to sink more time right now. This may be resolved in the openapi-generator project. It shouldn't affect us until we decide we want to start porting the SDK into other languages (so not very soon)

@brandon-groundlight brandon-groundlight merged commit 5e83865 into main Aug 15, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants